import React from 'react';
import AdminLayout from '@/components/admin/AdminLayout';
import { useAuth } from '@/hooks/useAuth';

export default function SimpleDashboard() {
  console.log('SimpleDashboard: Rendering simple dashboard');
  
  const { user } = useAuth();

  console.log('SimpleDashboard: User data', { user });

  return (
    <AdminLayout>
      <div className="p-6">
        <h1 className="text-2xl font-bold text-gray-800 mb-6">管理员仪表盘</h1>
        
        <div className="bg-white rounded-lg shadow p-6">
          <h2 className="text-lg font-semibold mb-4">欢迎回来！</h2>
          
          <div className="space-y-4">
            <div>
              <label className="font-medium text-gray-700">当前用户:</label>
              <span className="ml-2 text-gray-900">{user?.username || '未知'}</span>
            </div>
            
            <div>
              <label className="font-medium text-gray-700">用户角色:</label>
              <span className="ml-2 text-gray-900">{user?.role || '未知'}</span>
            </div>
            
            <div>
              <label className="font-medium text-gray-700">账户状态:</label>
              <span className={`ml-2 px-2 py-1 rounded text-sm ${
                user?.is_active ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
              }`}>
                {user?.is_active ? '活跃' : '非活跃'}
              </span>
            </div>
          </div>
          
          <div className="mt-6 pt-6 border-t border-gray-200">
            <h3 className="font-medium text-gray-700 mb-3">快速操作</h3>
            <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
              <a
                href="/admin/banners"
                className="p-4 bg-blue-50 rounded-lg text-center hover:bg-blue-100 transition-colors"
              >
                <i className="fa-solid fa-images text-blue-600 text-2xl mb-2"></i>
                <div className="text-sm font-medium text-blue-800">轮播图管理</div>
              </a>
              
              <a
                href="/admin/news"
                className="p-4 bg-green-50 rounded-lg text-center hover:bg-green-100 transition-colors"
              >
                <i className="fa-solid fa-newspaper text-green-600 text-2xl mb-2"></i>
                <div className="text-sm font-medium text-green-800">新闻管理</div>
              </a>
              
              <a
                href="/admin/services"
                className="p-4 bg-purple-50 rounded-lg text-center hover:bg-purple-100 transition-colors"
              >
                <i className="fa-solid fa-concierge-bell text-purple-600 text-2xl mb-2"></i>
                <div className="text-sm font-medium text-purple-800">服务管理</div>
              </a>
              
              <a
                href="/admin/company-info"
                className="p-4 bg-orange-50 rounded-lg text-center hover:bg-orange-100 transition-colors"
              >
                <i className="fa-solid fa-building text-orange-600 text-2xl mb-2"></i>
                <div className="text-sm font-medium text-orange-800">公司信息</div>
              </a>
            </div>
          </div>
        </div>
      </div>
    </AdminLayout>
  );
}
